package ihm;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class AccueilGuide extends JFrame implements ActionListener
{

	private JPanel contentPane;
	private JMenuBar menuBar;
	private JMenu mnFichier;
	private JMenuItem mntmImprimer;
	private JMenuItem mntmQuitter;
	private JMenu mnGestionEmbarcadere;
	private JMenuItem mntmGuide;
	private JMenuItem mntmCircuit;
	private JMenuItem mntmBarque;
	private JMenu mnGestionDesReservations;
	private JMenuItem mntmClient;
	private JMenuItem mntmReservation;
	private JMenuItem mntmBalade;
	private JMenuItem mntmAttribution;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args)
	{
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					AccueilGuide frame = new AccueilGuide();
					frame.setVisible(true);
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public AccueilGuide()
	{
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 746, 470);
		
		menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		mnFichier = new JMenu("FICHIER");
		menuBar.add(mnFichier);
		
		mntmImprimer = new JMenuItem("Imprimer");
		mnFichier.add(mntmImprimer);
		
		mntmQuitter = new JMenuItem("Quitter");
		mntmQuitter.addActionListener(this);
		mnFichier.add(mntmQuitter);
		
		mnGestionEmbarcadere = new JMenu("GESTION EMBARCADERE");
		menuBar.add(mnGestionEmbarcadere);
		
		mntmCircuit = new JMenuItem("Circuit");
		mntmCircuit.addActionListener(this);
		
		mntmBarque = new JMenuItem("Barque");
		mntmBarque.addActionListener(this);
		mnGestionEmbarcadere.add(mntmBarque);
		mnGestionEmbarcadere.add(mntmCircuit);
		
		mntmClient = new JMenuItem("Client");
		mntmClient.addActionListener(this);
		mnGestionEmbarcadere.add(mntmClient);
		
		mntmGuide = new JMenuItem("Guide");
		mntmGuide.addActionListener(this);
		mnGestionEmbarcadere.add(mntmGuide);
		
		mnGestionDesReservations = new JMenu("GESTION DES RESERVATIONS");
		menuBar.add(mnGestionDesReservations);
		
		mntmReservation = new JMenuItem("RESERVATION");
		mntmReservation.addActionListener(this);
		mnGestionDesReservations.add(mntmReservation);
		
		mntmBalade = new JMenuItem("BALADE");
		mntmBalade.addActionListener(this);
		mnGestionDesReservations.add(mntmBalade);
		
		mntmAttribution = new JMenuItem("ATTRIBUTION");
		mntmAttribution.addActionListener(this);
		mnGestionDesReservations.add(mntmAttribution);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
	}

	public void actionPerformed(ActionEvent evt) {
		
		
		
		if (evt.getSource()==mntmGuide)
		{
			contentPane.removeAll();
			 GestionGuide guide=new GestionGuide();
			 this.contentPane.add(guide);
			 guide.setVisible(true);
			 
			 guide.setTitle("Gestion Guide");
			 
		}
		
			if (evt.getSource()==mntmCircuit)
			{
				contentPane.removeAll();
				GestionCircuit circuit=new GestionCircuit();
				 this.contentPane.add(circuit);
				 circuit.setVisible(true);
				
				 circuit.setTitle("Gestion des Circuits");
			}
		
		if (evt.getSource()==mntmBarque)
			{
			
			    contentPane.removeAll();			   
			    GestionEmbarcation embarcation=new GestionEmbarcation();
				this.contentPane.add(embarcation);
				embarcation.setVisible(true);
				embarcation.setTitle("Gestion des Embarcations");
			}
		if (evt.getSource()==mntmClient)
		{
			contentPane.removeAll();
			GestionClient client=new GestionClient();
			this.contentPane.add(client);
			client.setVisible(true);
			client.setTitle("Gestion des Clients");
		}
		if (evt.getSource()==mntmReservation)
		{
			contentPane.removeAll();
			GestionReservation reserv=new GestionReservation();
			this.contentPane.add(reserv);
			reserv.setVisible(true);
			reserv.setTitle("Gestion des Reservations");
		}

	}
}
